<template>
	<uni-easyinput type="textarea" autoHeight v-model="content" placeholder="请输入内容"></uni-easyinput>
	<button @click="createComment()" style="font-size: 30px;font-weight: bold;color: white;background-color: #ff557f;width: 90%;border-radius: 10px;margin-top: 10px;">发布</button>
</template>

<script lang="ts" setup>
	import {
		ref,
		onMounted
	} from 'vue'
	import api from '../../../api/api'
	const movieId = ref()
	const content = ref()
	const userInfo =ref()
	const props = defineProps()
	onMounted(() => {
		movieId.value = props.movieId
		uni.getStorage({
			key:'userInfo',
			success:function(res){
				userInfo.value=res.data
				console.log(res)
			}
		})
	})
	
	const createComment= ()=>{
		api.comment.creatComment({
			content:content.value,
			movieId:movieId.value,
			userId:userInfo.value.user.userId
		}).then(res=>{
			if(res.data.code==0){
				uni.showToast({
					title:'发布成功'
				})
			}
		})
	}
</script>

<style>
</style>